﻿using Microsoft.AspNetCore.Components;

namespace BBCore.Server.Components.Pages.Admins
{
    /// <summary>
    /// 查看日记左侧的树列表目录
    /// </summary>
    public partial class LogsTreeLeftViewer
    {
        private HashSet<string> _expandedCategories = new HashSet<string>();

        private void ToggleCategory(string category)
        {
            if (_expandedCategories.Contains(category))
            {
                _expandedCategories.Remove(category);
            }
            else
            {
                _expandedCategories.Add(category);
            }
        }

        private async Task OnFileClick(string filePath)
        {
            // 调用父组件的方法
            if (OnFileSelected.HasDelegate)
            {
                await OnFileSelected.InvokeAsync(filePath);
            }
        }
        // 用来将事件回调暴露给父组件
        [Parameter]
        public EventCallback<string> OnFileSelected { get; set; }
    }
}
